package com.zkt.club.gateway.enums;

import lombok.Getter;

/**
 * @author 赵开泰
 * @program jc-club
 * @date 2024/9/30
 * @description 返回结果的code枚举
 **/

@Getter
public enum ResultCodeEnum {
	
	SUCCESS(200, "成功"),
	FAIL(500, "失败");
	
	private final int code;
	private final String desc;
	
	ResultCodeEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	public static ResultCodeEnum getByCode(int codeVal) {
		for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
			if (resultCodeEnum.getCode() == codeVal) {
				return resultCodeEnum;
			}
		}
		return null;
	}
	
}